

Ext.onReady(

function() {

	var thistab = Ext.get('岗位设置');
	thistab.clean(true);

	// 构造产品类别选择下拉列表
	var seleFields = [['110', '400V单路'], ['108', '400V多路'], ['107', '400V无线'],
			['106', '400V有线'], ['102', '485无线'], ['101', '485有线']];
	var store = new Ext.data.SimpleStore({
				fields : ['value', 'disp'],
				data : seleFields
			});

	var combo = new Ext.form.ComboBox({
				store : store,
				// id : 'comboField',
				// renderTo : thistab,
				displayField : 'disp',
				valueField : 'value',
				typeAhead : true,
				editable : false,
				mode : 'local',
				forceSelection : true,
				width : 200,
				triggerAction : 'all',
				emptyText : '请选择产品类别...',
				selectOnFocus : true
			});
	
	

	var qpn = new Ext.Toolbar({
				renderTo : thistab,
				items : [combo]
			});

	// 构造一个grid,显示产品拆分
	var sm = new Ext.grid.CheckboxSelectionModel();

	var cm = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({
						header : '序号',
						width : 30
					}),// 自动行号
			sm,// 添加的地方
			{
				header : '编码',
				dataIndex : 'id'
			}, {
				header : '名称',
				dataIndex : 'typename'
			}, {
				header : '区域',
				dataIndex : 'functype'
			}, {
				header : '元器件信息',
				dataIndex : 'typeinfo'
			}, {
				header : '是否使用',
				dataIndex : 'inuse',
				renderer : function(val) {
					if (val == '1')
						return '有效';
					else
						return '无效';
				}
			}

	]);
	cm.defaultSortable = true;

	var obj = Json
			.evaluate(" {\"command\":\"\",\"condi\":\"\",\"functype\":null,\"id\":null,\"ids\":null,\"inuse\":null,\"notlog\":false,\"pageCount\":\"25\",\"pageNo\":\"1\",\"pi\": {\"list\":[{\"functype\":\"左上部分\",\"id\":110,\"inuse\":\"1\",\"typeinfo\":\"电容区 u202 u406 A308\",\"typename\":\"焊接区1\"},{\"functype\":\"右下部分\",\"id\":108,\"inuse\":\"1\",\"typeinfo\":\"电阻R101 R102 R108\",\"typename\":\"电阻区\"}, {\"functype\":\"左下区\",\"id\":107,\"inuse\":\"1\",\"typeinfo\":\"变压线路部分\",\"typename\":\"供电区\"},{\"functype\":\"右下区\",\"id\":106,\"inuse\":\"1\",\"typeinfo\":\"芯片焊接区\",\"typename\":\"芯片区\"}],\"pageCount\":25,\"pageNo\":1,\"totalCount\":9,\"totalPage\":1},\"result\":false,\"rtntxt\":null,\"typeinfo\":null,\"typename\":null}");
	var data1 = obj.pi;
	var ds = new Ext.data.Store({
				proxy : new Ext.data.MemoryProxy(data1),
				reader : new Ext.data.JsonReader({
							root : 'list'
						}, [{
									name : 'id'
								}, {
									name : 'typename'
								}, {
									name : 'functype'
								}, {
									name : 'typeinfo'
								}, {
									name : 'inuse'
								}])
			});

	ds.load();

	var grid = new Ext.grid.GridPanel({
				ds : ds,
				cm : cm,
				sm : sm,
				title : '选择元器件',
				autoWidth : true,
				height : 150,
				// bodyStyle : 'padding:10px 10px 0',
				// autoHeight : true,
				// autoScroll : true,
				renderTo : thistab,
				border : true,// 出现边框
				// loadMask : true,
				loadMask : {
					msg : '正在载入数据……'
				},
				viewConfig : {
					sortAscText : '升序',
					sortDescText : '降序',
					columnsText : '显示列',
					forceFit : true,
					autoFill : true,
					deferEmptyText : '请等待...',
					emptyText : '没有数据',
					enableRowBody : true
				}

			});

	var sm1 = new Ext.grid.CheckboxSelectionModel();
	var cm1 = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({
						header : '序号',
						width : 30
					}),// 自动行号
			sm1,// 添加的地方
			{
				header : '编码',
				dataIndex : 'id',
				hidden : true
			}, {
				header : '产品编码',
				dataIndex : 'procode',
				width : 100
			}, {
				header : '类别名称',
				dataIndex : 'typeid'
			}, {
				header : '产品条码',
				dataIndex : 'barcode',
				hidden : true
			}, {
				header : '产品箱号',
				dataIndex : 'boxcode',
				hidden : true
			}, {
				header : '产品批号',
				dataIndex : 'lotnum',
				hidden : true
			}, {
				header : '生产日期',
				dataIndex : 'prodate'
			}, {
				header : '产品信息',
				dataIndex : 'promemo'
			}, {
				header : '返修次数',
				hidden : true,
				dataIndex : 'repairnum'
			}, {
				header : '程序版本',
				dataIndex : 'proversion',
				hidden : true
			}, {
				header : '产品状态',
				dataIndex : 'prostatus',
				hidden : true,
				renderer : function(val) {
					if (val == '1')
						return '入库';
					else
						return '新生产';
				}
			}, {
				header : '是否虚拟',
				hidden : true,
				dataIndex : 'virtualmark',
				renderer : function(val) {
					if (val == '1')
						return '虚拟';
					else
						return '实际';
				}
			}]);
	cm1.defaultSortable = true;

	
	var obj1 = Json
			.evaluate(" {\"barcode\":null,\"boxcode\":null,\"command\":null,\"condi\":\"\",\"id\":null,\"ids\":null,\"lotnum\":null,\"notlog\":false,\"pageCount\":\"25\",\"pageNo\":\"1\",\"pi\": {\"list\": [{\"barcode\":\"010808052327\",\"boxcode\":null,\"id\":100134475,\"lotnum\":null,\"procode\":\"010808052327\",\"prodate\":null,\"promemo\":\" 管理员补录历史返修信息\",\"prostatus\":\"1\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":1,\"typeid\":108,\"virtualmark\":\"1\"}, {\"barcode\":\"010808052385\",\"boxcode\":\"Z212\",\"id\":100134474,\"lotnum\":\"11111111\",\"procode\":\"010808052385\",\"prodate\":null,\"promemo\":\" 管理员补录历史返修信息\",\"prostatus\":\"0\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":1,\"typeid\":108,\"virtualmark\":\"1\"}, {\"barcode\":\"010808080675\",\"boxcode\":\"Z214\",\"id\":100134473,\"lotnum\":\"11111111\",\"procode\":\"010808080675\",\"prodate\":null,\"promemo\":\" 管理员补录历史返修信息\",\"prostatus\":\"0\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":1,\"typeid\":108,\"virtualmark\":\"1\"}, {\"barcode\":\"010808080599\",\"boxcode\":\"Z214\",\"id\":100134472,\"lotnum\":\"11111111\",\"procode\":\"010808080599\",\"prodate\":null,\"promemo\":\" 管理员补录历史返修信息\",\"prostatus\":\"0\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":1,\"typeid\":108,\"virtualmark\":\"1\"}, {\"barcode\":\"010808052262\",\"boxcode\":\"Z214\",\"id\":100134471,\"lotnum\":\"11111111\",\"procode\":\"010808052262\",\"prodate\":null,\"promemo\":\" 管理员补录历史返修信息\",\"prostatus\":\"0\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":1,\"typeid\":108,\"virtualmark\":\"1\"}, {\"barcode\":\"030608110041\",\"boxcode\":null,\"id\":100134470,\"lotnum\":\"20090414\",\"procode\":\"030608110041\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110049\",\"boxcode\":null,\"id\":100134469,\"lotnum\":\"20090414\",\"procode\":\"030608110049\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110043\",\"boxcode\":null,\"id\":100134468,\"lotnum\":\"20090414\",\"procode\":\"030608110043\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110088\",\"boxcode\":null,\"id\":100134467,\"lotnum\":\"20090414\",\"procode\":\"030608110088\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110109\",\"boxcode\":null,\"id\":100134466,\"lotnum\":\"20090414\",\"procode\":\"030608110109\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110130\",\"boxcode\":null,\"id\":100134465,\"lotnum\":\"20090414\",\"procode\":\"030608110130\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110079\",\"boxcode\":null,\"id\":100134464,\"lotnum\":\"20090414\",\"procode\":\"030608110079\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110051\",\"boxcode\":null,\"id\":100134463,\"lotnum\":\"20090414\",\"procode\":\"030608110051\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110108\",\"boxcode\":null,\"id\":100134462,\"lotnum\":\"20090414\",\"procode\":\"030608110108\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110111\",\"boxcode\":null,\"id\":100134461,\"lotnum\":\"20090414\",\"procode\":\"030608110111\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110052\",\"boxcode\":null,\"id\":100134460,\"lotnum\":\"20090414\",\"procode\":\"030608110052\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110131\",\"boxcode\":null,\"id\":100134459,\"lotnum\":\"20090414\",\"procode\":\"030608110131\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110044\",\"boxcode\":null,\"id\":100134458,\"lotnum\":\"20090414\",\"procode\":\"030608110044\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110129\",\"boxcode\":null,\"id\":100134457,\"lotnum\":\"20090414\",\"procode\":\"030608110129\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110050\",\"boxcode\":null,\"id\":100134456,\"lotnum\":\"20090414\",\"procode\":\"030608110050\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110122\",\"boxcode\":null,\"id\":100134455,\"lotnum\":\"20090414\",\"procode\":\"030608110122\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110110\",\"boxcode\":null,\"id\":100134454,\"lotnum\":\"20090414\",\"procode\":\"030608110110\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"}, {\"barcode\":\"030608110090\",\"boxcode\":null,\"id\":100134453,\"lotnum\":\"20090414\",\"procode\":\"030608110090\",\"prodate\":\"2009-04-14T00:00:00\",\"promemo\":\" 仓库补充丢失数据\",\"prostatus\":\"1\",\"proversion\":\"V0523\",\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":106,\"virtualmark\":\"0\"},{\"barcode\":\"C9\",\"boxcode\":null,\"id\":100134452,\"lotnum\":\"20090626\",\"procode\":\"0801011200104\",\"prodate\":\"2009-06-26T00:00:00\",\"promemo\":null,\"prostatus\":\"1\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":101,\"virtualmark\":\"0\"},{\"barcode\":\"C5\",\"boxcode\":null,\"id\":100134451,\"lotnum\":\"20090626\",\"procode\":\"0810011200180\",\"prodate\":\"2009-06-26T00:00:00\",\"promemo\":null,\"prostatus\":\"1\",\"proversion\":null,\"rejectmark\":\"0\",\"repairnum\":0,\"typeid\":101,\"virtualmark\":\"0\"}],\"pageCount\":25,\"pageNo\":1,\"totalCount\":65981,\"totalPage\":2640},\"procode\":null,\"prodate\":null,\"promemo\":null,\"prostatus\":null,\"proversion\":null,\"rejectmark\":null,\"repairnum\":null,\"result\":false,\"rtntxt\":null,\"typeid\":null,\"virtualmark\":null}"
			);
			var data2 = obj1.pi;
	var ds1 = new Ext.data.Store({
				proxy : new Ext.data.MemoryProxy(data2),
				reader : new Ext.data.JsonReader({
							root : 'list'
						}, [{
									name : 'id'
								}, {
									name : 'lotnum'
								}, {
									name : 'procode'
								}, {
									name : 'barcode'
								}, {
									name : 'boxcode'
								}, {
									name : 'prodate'/*
													 * , type : 'date',
													 * dateFormat : 'Y-m-d'
													 */
								}, {
									name : 'promemo'
								}, {
									name : 'prostatus'
								}, {
									name : 'proversion'
								}, {
									name : 'repairnum'
								}, {
									name : 'virtualmark'
								}, {
									name : 'typeid'
								}])
			});

	ds1.load();

	var grid1 = new Ext.grid.GridPanel({
				ds : ds1,
				cm : cm1,
				sm : sm1,
				title : '选择产品',
				autoWidth : true,
				height : 150,
				// bodyStyle : 'padding:10px 10px 0',
				// autoHeight : true,
				autoScroll : true,
				renderTo : thistab,
				border : true,// 出现边框
				// loadMask : true,
				loadMask : {
					msg : '正在载入数据……'
				},
				viewConfig : {
					sortAscText : '升序',
					sortDescText : '降序',
					columnsText : '显示列',
					forceFit : true,
					autoFill : true,
					deferEmptyText : '请等待...',
					emptyText : '没有数据',
					enableRowBody : true
				}

			});
var save = new Ext.Toolbar({
				renderTo : thistab,
				items : [{text:'保存提交'}]
			});
});